#coding=utf-8
"""
功能描述：mysql连接
"""
import pymysql, redis, cx_Oracle
"""
功能描述：获取mysql连接
"""
def getMysql():
    return pymysql.connect(host='127.0.0.1',
              port=3306,
              user='root',
              password='root_123',
              db='loozb',
              charset='utf8mb4',
              cursorclass=pymysql.cursors.DictCursor)
"""
获取redis连接
"""
def getRedis():
    return redis.Redis(host='127.0.0.1', port=6379, db=0)

def getOracle():
    return cx_Oracle.connect('prt050a/haiyu_1990_today@localhost/orcl')

def countForOracle(sql, conn):
    cursor = conn.cursor()
    cursor.execute(sql)
    cursor.fetchall()
    count = cursor.rowcount
    if count > 0:
        return True
    else:
        return False;

def executOracle(sql, params, conn):
    cursor = conn.cursor()
    cursor.execute(sql, params);
    cursor.close()
    conn.commit()

if __name__ == '__main__':
    conn = getOracle();
    print(conn)